package com.choudou5.nlp.util;

import com.choudou5.solr.util.JsonUtil;
import com.choudou5.solr.util.StrUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * @name 词性映射
 * @author choudou5
 * @date 2018-08-07
 */
public enum  WordTypeEnum {

    //词性对照表
    A_T("形容词", "tencent", "1"),
    AD_T("副形词", "tencent", "2"),
    AN_T("名形词", "tencent", "3"),
    B_T("区别词", "tencent", "4"),
    C_T("连词", "tencent", "5"),
    D_T("副词", "tencent", "6"),
    E_T("叹词", "tencent", "7"),
    F_T("方位词", "tencent", "8"),
    G_T("语素词", "tencent", "9"),
    H_T("前接成分", "tencent", "10"),
    I_T("成语", "tencent", "11"),
    J_T("简称略语", "tencent", "12"),
    K_T("后接成分", "tencent", "13"),
    L_T("习用语", "tencent", "14"),
    M_T("数词", "tencent", "15"),
    N_T("名词", "tencent", "16"),
    N_S("名词", "sougou", "n"),
    NR_T("人名", "tencent", "17"),
    NRF_T("姓", "tencent", "18"),
    NRG_T("名", "tencent", "19"),
    NS_T("地名", "tencent", "20"),
    NT_T("机构团体", "tencent", "21"),
    NZ_T("其他专名", "tencent", "22"),
    NX_T("非汉字串", "tencent", "23"),
    O_T("拟声词", "tencent", "24"),
    P_T("介词", "tencent", "25"),
    Q_T("量词", "tencent", "26"),
    R_T("代词", "tencent", "27"),
    S_T("处所词", "tencent", "28"),
    T_T("时间词", "tencent", "29"),
    U_T("助词", "tencent", "30"),
    V_T("动词", "tencent", "31"),
    V_S("动词", "sougou", "v"),
    VD_T("副动词", "tencent", "32"),
    VN_T("名动词", "tencent", "33"),
    W_T("标点符号", "tencent", "34"),
    X_T("非语素字", "tencent", "35"),
    Y_T("语气词", "tencent", "36"),
    Z_T("状态词", "tencent", "37"),
    AG_T("形语素", "tencent", "38"),
    BG_T("区别语素", "tencent", "39"),
    DG_T("副语素", "tencent", "40"),
    MG_T("数词性语素", "tencent", "41"),
    NG_T("名语素", "tencent", "42"),
    QG_T("量语素", "tencent", "43"),
    RG_T("代语素", "tencent", "44"),
    TG_T("动语素", "tencent", "45"),
    VG_T("量语素", "tencent", "46"),
    YG_T("语气词语素", "tencent", "47"),
    ZG_T("状态词语素", "tencent", "48"),

    ;

    WordTypeEnum(String name, String channel, String rawKey) {
        this.name = name;
        this.channel = channel;
        this.rawKey = rawKey;
    }

    private String name;
    private String channel;
    private String rawKey;


    private static final Map<String, String> CACHE_MAP = new HashMap();

    static {
        WordTypeEnum[] values = values();
        for (WordTypeEnum type : values) {
            CACHE_MAP.put(type.getChannel()+"_"+type.getRawKey(), type.getKey());
        }
    }

    public static void main(String[] args) {
        System.out.println(JsonUtil.toStr(CACHE_MAP));
    }
    public static String getKey(String channel, String rawKey){
        return CACHE_MAP.get(channel+"_"+rawKey);
    }

    public String getKey() {
        return StrUtil.subBefore(name.toLowerCase(), "_", false);
    }

    public String getName() {
        return name;
    }
    public String getChannel() {
        return channel;
    }
    public String getRawKey() {
        return rawKey;
    }

}
